From 3418e4201183ba507a2a4c4124d2fdd2f5213240 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 23 Nov 2016 11:36:28 +0100 Subject: [PATCH] babl-cache: incorporate BABL_PATH_LENGTH in header --- babl/babl-cache.c | 8 ++++---- babl/babl-fish-path.c | 5 +++++ babl/babl-internal.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/babl/babl-cache.c b/babl/babl-cache.c index e32e585..8d5ed61 100644 --- a/babl/babl-cache.c +++ b/babl/babl-cache.c @@ -142,8 +142,8 @@ void babl_store_db (void) FILE *dbfile = fopen (fish_cache_path (), "w"); if (!dbfile) return; - fprintf (dbfile, "#%s BABL_TOLERANCE=%f\n", - BABL_GIT_VERSION, _babl_legal_error ()); + fprintf (dbfile, "#%s BABL_PATH_LENGTH=%d BABL_TOLERANCE=%f\n", + BABL_GIT_VERSION, _babl_max_path_len (), _babl_legal_error ()); /* sort the list of fishes by usage, making next run more efficient - * and the data easier to approach as data for targeted optimization @@ -256,8 +256,8 @@ void babl_init_db (void) /* if babl has changed in git .. drop whole cache */ { char buf[2048]; - sprintf (buf, "#%s BABL_TOLERANCE=%f", - BABL_GIT_VERSION, _babl_legal_error ()); + sprintf (buf, "#%s BABL_PATH_LENGTH=%d BABL_TOLERANCE=%f", + BABL_GIT_VERSION, _babl_max_path_len (), _babl_legal_error ()); if (strcmp ( token, buf)) { free (contents); diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index cbe9618..f4df8cf 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -145,6 +145,11 @@ static int max_path_length (void) return max_length; } +int _babl_max_path_len (void) +{ + return max_path_length (); +} + /* The task of BablFishPath construction is to compute * the shortest path in a graph where formats are the vertices * and conversions are the edges. However, there is an additional diff --git a/babl/babl-internal.h b/babl/babl-internal.h index 992a770..228faa5 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -319,5 +319,6 @@ static inline double babl_parse_double (const char *str) double _babl_legal_error (void); void babl_init_db (void); void babl_store_db (void); +int _babl_max_path_len (void); #endif -- 2.30.2